/*
 * @lc app=leetcode.cn id=1380 lang=typescript
 *
 * [1380] 矩阵中的幸运数
 */

// @lc code=start
function luckyNumbers(matrix: number[][]): number[] {
    const result: number[] = [];
    matrix.forEach((row) => {
        const min = Math.min(...row);
        const index = row.indexOf(min);
        const max = Math.max(...matrix.map((i) => i[index]));
        if (min === max) {
            result.push(min);
        }
    });
    return result;
}
// @lc code=end
